#{extends 'Discount/discount.html' /}

#{set selected:'approve' /}

#{if discountsWaiting ?: yes}
<table>
    <thead>
        <tr>
            <th>Description</th>
            <th>Creator</th>
            <th>Valid until</th>
            <th>Action</th>
        </tr>
    </thead>
    <tbody>
    #{list items:discountsWaiting, as:'discount'}
        <tr>
            <td>${discount.description}</td>
            <td>${discount.discountCreator.userName}</td>
            <td>
            #{if discount.expirationDate}
               ${discount.expirationDate.format('MMM dd')}
            #{/if}
            #{else}
               Never
            #{/else}
            </td>
            <td>#{a @Discount.accept(discount.id)} Accept #{/a} | #{a @Discount.reject(discount.id)} Reject #{/a}</td>
        </tr>
    #{/list}
    </tbody>
</table>
#{/if}